//
// Created by yunnan xu on 2020/11/10.
//

#ifndef ANDROIDGRAPHICSDEMOS_RESOURCEMGR_H
#define ANDROIDGRAPHICSDEMOS_RESOURCEMGR_H

#include "Singleton.h"
#include <android/asset_manager.h>
#include <android/asset_manager_jni.h>
#include <android/storage_manager.h>

enum ResourceMgrErrno
{
    FileNotExist = -100,
};


class ResourceMgr : public Singleton<ResourceMgr>
{

public:
    ResourceMgr();
    ~ ResourceMgr() {}

    long GetFileLength(const char * filename, int mode = AASSET_MODE_UNKNOWN);
    int ReadFile(const char * filename, void * buffer, int count, int mode = AASSET_MODE_UNKNOWN);

private:

    AAssetManager * aAssetManager = nullptr;
};


#endif //ANDROIDGRAPHICSDEMOS_RESOURCEMGR_H
